package com.change.declare.declare.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.change.declare.declare.entity.OrderconsigneesEntity;
import com.change.declare.declare.service.OrderconsigneesService;
import com.change.common.utils.PageUtils;
import com.change.common.utils.R;



/**
 * 
 *
 * @author LK
 * @email hmscrdlk@gmail.com
 * @date 2020-07-11 23:05:53
 */
@RestController
@RequestMapping("declare/orderconsignees")
public class OrderconsigneesController {
    @Autowired
    private OrderconsigneesService orderconsigneesService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("declare:orderconsignees:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderconsigneesService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("declare:orderconsignees:info")
    public R info(@PathVariable("id") Long id){
		OrderconsigneesEntity orderconsignees = orderconsigneesService.getById(id);

        return R.ok().put("orderconsignees", orderconsignees);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("declare:orderconsignees:save")
    public R save(@RequestBody OrderconsigneesEntity orderconsignees){
		orderconsigneesService.save(orderconsignees);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("declare:orderconsignees:update")
    public R update(@RequestBody OrderconsigneesEntity orderconsignees){
		orderconsigneesService.updateById(orderconsignees);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("declare:orderconsignees:delete")
    public R delete(@RequestBody Long[] ids){
		orderconsigneesService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
